import numpy as np
import pandas as pd

#使用数组
df1 = pd.DataFrame([1,2,3,4,5,6])
print('df1:\n{}'.format(df1))

#使用嵌套数组
pd2 = pd.DataFrame([['a','A'],['b','B'],['c','C'],['d','D']])
print('pd2:\n{}'.format(pd2))

pd3 = pd.DataFrame([("a","A"),("b","B"),("c","C"),("d","D")])
print('pd3: \n{}'.format(pd3))

#列索引

pd4 = pd.DataFrame([("a","A"),("b","B"),("c","C"),("d","D")],columns=["小写","大写"])
print('pd4:\n{}'.format(pd4))

#行索引
pd5 = pd.DataFrame([("a","A"),("b","B"),("c","C"),("d","D")],columns=["小写","大写"],index=["第一行","第二行","第三行","第四行"])
print('pd5:\n{}'.format(pd5))

data = {"小写":["a","b","c","d"],"大写":["A","B","C","D"]}
pd6 = pd.DataFrame(data,index=["第一行","第二行","第三行","第四行"])
print(pd6)


#获取DataFrame列索引
print(pd6.columns)

#获取DataFrame行索引
print(pd6.index)

